package com.gxd.base.entity;

import java.util.ArrayList;
import java.util.List;

public class PageBean<T> {
	private int pageSize = 10;// 页显示条数
	private int currentPage;// 当前页码
	private int totalSize;// 总记录条数
	private List<T> list = new ArrayList<T>();// 记录

	private T entiy  ;

	public PageBean() {
	}

	public PageBean(int currentPage, int totalSize, T entiy) {
		this.currentPage = currentPage;
		this.totalSize = totalSize;
		this.entiy = entiy;
	}

	public PageBean(int currentPage, int totalSize, List<T> list) {
		this.currentPage = currentPage;
		this.totalSize = totalSize;
		this.list = list;
	}

	public PageBean(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getTotalSize() {
		return totalSize;
	}

	public void setTotalSize(int totalSize) {
		this.totalSize = totalSize;
	}

	public int getTotalPage() {
		int totalSize = getTotalSize();
		return (int) (totalSize % pageSize == 0 ? (totalSize / pageSize) : (totalSize / pageSize + 1));
	}

	public void setTotalPage(int totalPage) {
	}

	public List<T> getList() {
		return list;
	}

	public void setList(List<T> list) {
		this.list = list;
	}

	public int getBeginSize() {
		return currentPage > 0 ? (currentPage - 1) * pageSize + 1 : 0;
	}

	public void setBeginSize(int beginSize) {
	}

	public int getEndSize() {
		int beginSize = getBeginSize();
		return beginSize + pageSize - (beginSize > 0 ? 1 : 0);
	}

	public void setEndSize(int endSize) {
	}

	public T getEntiy() {
		return entiy;
	}

	public void setEntiy(T entiy) {
		this.entiy = entiy;
	}
}
